/*
 * 8.2.cpp
 *
 *  Created on: 2012-5-21
 *      Author: jawinton
 */

#include <iostream>
#include <cstring>
#include <cstdio>

char left[3][7], right[3][7], result[3][5];

bool isLight(char c) {
	for (int i=0; i<3; i++) {
		if (strcmp(result[i], "even") == 0) {
			if(strchr(left[i], c) != NULL || strchr(right[i], c) != NULL)
				return false;
		}
		else if (strcmp(result[i], "up") == 0){
			if (strchr(right[i], c) == NULL)
				return false;
		} else if (strcmp(result[i], "down") == 0){
			if (strchr(left[i], c) == NULL)
				return false;
		}
	}
	return true;
}

bool isHeavy(char c) {
	for (int i=0; i<3; i++) {
		if (strcmp(result[i], "even") == 0) {
			if(strchr(left[i], c) != NULL || strchr(right[i], c) != NULL)
				return false;
		}
		else if (strcmp(result[i], "down") == 0){
			if (strchr(right[i], c) == NULL)
				return false;
		} else if (strcmp(result[i], "up") == 0){
			if (strchr(left[i], c) == NULL)
				return false;
		}
	}
	return true;
}

int main (void) {
	int n;
	scanf("%d", &n);
	while (n--) {
		for (int i=0; i<3; i++)
			scanf("%s %s %s", left[i], right[i], result[i]);
		char c;
		for (c='A'; c<='L'; c++) {
			if (isHeavy(c)) {
				printf("%c is the counterfeit coin and it is heavy.\n", c);
				break;
			} else if (isLight(c)) {
				printf("%c is the counterfeit coin and it is light.\n", c);
				break;
			}
		}
	}
	return 0;
}
